// Decompiled by DJ v3.9.9.91 Copyright 2005 Atanas Neshkov  Date: 4/12/2007 09:14:30
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   RLabel.java

package utility;

import java.awt.*;
import java.util.Locale;

// Referenced classes of package de.escape.quincunx.i18n:
//            I18n, Localizable

public class RLabel extends Label
    implements Localizable
{

    public RLabel(String textRes)
    {
        localeUnknown = true;
        setText(I18n.getString(textRes, getLocale()));
        textResource = textRes;
    }

    public RLabel(String textRes, int align)
    {
        super("", align);
        localeUnknown = true;
        setText(I18n.getString(textRes, getLocale()));
        textResource = textRes;
    }

    public RLabel(String textRes, String add)
    {
        localeUnknown = true;
        setText(I18n.getString(textRes, getLocale()) + add);
        textResource = textRes;
        addText = add;
    }

    public RLabel(String textRes, String add, int align)
    {
        super("", align);
        localeUnknown = true;
        setText(I18n.getString(textRes, getLocale()) + add);
        textResource = textRes;
        addText = add;
    }

    public void setLocale(Locale l)
    {
        super.setLocale(l);
        if(addText == null)
            setText(I18n.getString(textResource, l));
        else
            setText(I18n.getString(textResource, l) + addText);
        invalidate();
    }

    public Locale getLocale()
    {
        try
        {
            localeUnknown = false;
            return super.getLocale();
        }
        catch(IllegalComponentStateException _ex)
        {
            localeUnknown = true;
        }
        return null;
    }

    public void update(Graphics g)
    {
        if(localeUnknown)
            setLocale(getLocale());
        else
            super.update(g);
    }

    protected boolean localeUnknown;
    protected String textResource;
    protected String addText;
}